package com.xbxkj.api.web.controller;


import org.springframework.web.bind.annotation.RequestMapping;
import com.xbxkj.commen.bean.layuiBean.ResultPage;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ResponseBody;
import com.xbxkj.commen.controller.model.ResultModel;
import com.xbxkj.commen.bean.RolePermission;
import java.util.HashMap;
import java.util.List;
    import com.xbxkj.commen.controller.helper.V;
    import com.xbxkj.commen.controller.helper.X;
    import com.xbxkj.commen.controller.model.ResultModel;

import java.util.Map;
    import com.xbxkj.commen.controller.BaseController;

/**
 * <p>
 * 角色菜单关联表 前端控制器
 * </p>
 *
 * @author 张子艺
 * @since 2020-01-09
 */
@Controller
@RequestMapping("/admin/rolePermission")
public class RolePermissionController extends BaseController{
     /** 主页面 */
    @RequestMapping("main.html")
    public String main(){
       return  "RolePermission/RolePermissionMain";
    }
    /** 添加页面跳转
     * @return 返回页面
     */
    @RequestMapping(value = "/addRolePermissionHtml")
    public String addRolePermissionHtml( ){
             return "RolePermission/RolePermissionAdd";
    }
    /** 编辑页面跳转
     * @param  id  前端传进的参数
     * @return 返回页面
     */
    @RequestMapping(value = "/editRolePermissionHtml")
    public String editRolePermissionHtml(String id ,Model model ){
           model.addAttribute("rolePermission",rolePermissionService.selectRolePermissionByIdRolePermission(id));
             return "RolePermission/RolePermissionEdit";
    }

    /** 查看页面跳转
     * @param  id  前端传进的参数
     * @return 返回页面
     */
    @RequestMapping(value = "/showRolePermissionHtml")
    public String showRolePermissionHtml(String id ,Model model ){
           model.addAttribute("rolePermission",rolePermissionService.selectRolePermissionByIdRolePermission(id));
             return "RolePermission/RolePermissionShow";
    }


    /** 分页查询RolePermission
     * @param page  页码
     * @param limit  查几条
     * @param rolePermission  前端传进的参数
     * @return 返回统一分页信息
     */
    @RequestMapping(value = "/findRolePermissionByPage")
    @ResponseBody
    public ResultPage findRolePermissionByPage(Integer page, Integer limit,RolePermission rolePermission){
             return rolePermissionService.findRolePermissionByPage(page,limit,rolePermission);
    }

    /** 添加RolePermission
     * @param rolePermission  前端传进的参数
     * @return 返回统一信息
     */
    @RequestMapping(value = "/addRolePermission")
    @ResponseBody
    public ResultModel<?> saveRolePermission(RolePermission rolePermission  ){
             return rolePermissionService.addRolePermission(rolePermission);
    }

    /** 编辑RolePermission
     * @param rolePermission  前端传进的参数
     * @return 返回统一信息
     */
    @RequestMapping(value = "/editRolePermission")
    @ResponseBody
    public ResultModel<?> editRolePermission(RolePermission rolePermission  ){
             return rolePermissionService.editRolePermission(rolePermission);
    }



    /** 删除一条RolePermission
     * @param id  前端传进的ID
     * @return 返回统一信息
     */
    @RequestMapping(value = "/delRolePermission")
    @ResponseBody
    public ResultModel<?> delRolePermission( String id  ){
             return rolePermissionService.delRolePermission(id);
    }


}
